﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace BRS.BidModule
{
    public partial class UpdateTender : Form
    {
        Entities brs = new Entities();
        int pid;
        public UpdateTender()
        {
            InitializeComponent();
        }
        public UpdateTender(int id)
        {
            InitializeComponent();
            var tender = brs.TenderMsg.Find(id);
            pid=id;
            label3.Text=pid.ToString();
            textBox1.Text = tender.Name;
            comboBox1.SelectedIndex = tender.Type=="招标人"? 0 : 1;

        }
        private void button1_Click(object sender, EventArgs e)
        {
            var pro = brs.TenderMsg.Find(pid);
            if (pro != null)
            {
                pro.Id= int.Parse(label3.Text);
                pro.Name = this.textBox1.Text;
                pro.Type = comboBox1.SelectedItem.ToString();
                pro.AddTime=DateTime.Now;
                if (brs.SaveChanges() > 0) { MessageBox.Show("修改成功！"); };
            }

        }
    }
}
